<template>
  <div>
    <div class="remeng">
      <h2>热门城市</h2>
      <div class="box">
        <div class="city" v-for="(v, i) in Rmcity" :key="i" @click="fungo(v)">
          {{ v }}
        </div>
      </div>
    </div>
    <ul class="celan">
      <li v-for="(v, i) in arr" :key="i">{{ v }}</li>
    </ul>
    <div class="all" v-for="(items, index) in all" :key="index">
      <span class="title">{{ Object.keys(items)[0] }}</span>
      <span
        class="content"
        v-for="(ads, inde) in items[Object.keys(items)[0]]"
        :key="inde"
        @click="fungo(ads)"
        >{{ ads }}</span
      >
    </div>
  </div>
</template>

<script>
import { getlink } from "@/api/getlink.js";
export default {
  data() {
    return {
      Rmcity: [
        "上海市",
        "杭州市",
        "北京市",
        "广州市",
        "天津市",
        "南京市",
        "武汉市",
        "苏州市",
        "福州市",
      ],
      arr: ["#"],
      all: [],
      adrs: [],
    };
  },
  mounted() {
    for (var i = 0; i < 26; i++) {
      this.arr.push(String.fromCharCode(65 + i));
    }
    getlink("/data/address").then((ok) => {
      this.all = ok.data.all;
    });
  },
  methods: {
    fungo(data) {
      this.$store.commit("upcity", { newcity: data });
      this.$router.go(-1);
    },
  },
};
</script>

<style scoped  >
.remeng {
  width: 100%;
  height: 2rem;
  padding: 0.1rem;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}
h2 {
  width: 100%;
}
.box {
  width: 3.2rem;
  height: 1.2rem;
  margin: 0.14rem 0.1rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-content: space-between;
}
.city {
  width: 1rem;
  height: 0.34rem;
  background-color: #f7f7f7;
  border-radius: 0.06rem;
  font-size: 0.14rem;
  text-align: center;
  line-height: 0.34rem;
}
.celan {
  width: 0.12rem;
  position: fixed;
  top: 1.5rem;
  right: 0;
  font-size: 0.12rem;
}
.celan > li {
  width: 100%;
  height: 0.2rem;
}
.all {
  width: 100%;
  font-size: 0.14rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;

  padding: 0.1rem;
  background-color: #fff;
}
.content {
  width: 3.24rem;
  height: 0.5rem;
  margin-left: 0.2rem;
  border-bottom: 2px solid #b8b8b8;
  line-height: 0.5rem;
}
</style>